#pragma once
#include <cstdint>

namespace myFs {
namespace basic {
//位图持久
using size_t = std::uint32_t;
class Bitset {
   public:
    Bitset();
    Bitset(void* baseptr, size_t bitnum);
    void init(void* baseptr, size_t bitnum);
    void set(size_t i);
    bool at(size_t i) const;
    void reset(size_t i);
    size_t size() const;
    size_t used() const;
    size_t usedSync();

   private:
    size_t bitCountAll();
    uint32_t bitCountOne(uint32_t n);

    size_t* m_baseptr;
    size_t m_bitnum;
    size_t m_used;
};
}  // namespace basic
}  // namespace myFs